home *** CD-ROM | disk | FTP | other *** search
Text File | 1996-06-25 | 4.4 KB | 106 lines | [TEXT/CWIE] |
- AGA Slider: A demo of class CAGASlider v 1.0 June 25, 1996
- 68K
- CodeWarrior 9
- PowerPlant
-
- ================================================================================
-
- AGA Slider is a project for demonstrating the CAGASlider class.
-
- CAGASlider is a PowerPlant LControl that looks like a slider from
- the Apple Grayscale Appearance for System 7. It is not a CDEF.
-
- Apple's docs on the AGA show you what things look like to the pixel,
- but, alas, they don't explain behaviors. I had to guess, mostly by
- imitating the slider in the Sound control panel.
-
- Feel free to send me any comments, suggestions, and bug-reports at:
- jennings@halycon.com (James Jennings)
-
- CAGASlider is copyright © 1996 by James Jennings. All rights reserved.
- You may freely use it for non-commercial projects and inexpensive shareware.
-
- ================================================================================
-
- Features of CAGASlider:
-
- Mouse down in the indicator shows a "pressed" indicator.
- As indicator is dragged, the pressed indicator doesn't move and a "ghost"
- indicator follows the mouse.
- The ghost indicator disappears when it's over the pressed indicator.
- Clicking on the "track" jumps the indicator to that position.
- When the mouse is released, the real indicator moves to the ghost's last position.
- When the mouse is dragged away from the track, the ghost disappears. (Aborting.)
- Horizontal and vertical sliders are centered in the pane. (Needs >=16 pixel width.)
- "Pointing" sliders (which have tick marks) are aligned to the side of the pane away
- from the pointer and the tick marks. (Needs >=25 pixel width.)
- Sliders are drawn correctly when Disabled().
- Uses StOffscreenGWorld for flicker-free tracking.
- Looks reasonable on black and white screens.
- Looks reasonable when split across two monitors of different pixel depths. (Although,
- since I only have one monitor myself, this hasn't been tested as much as I'd like.)
-
- Limitations:
- Doesn't have value labels. If you add your own (with an LCaption, say)
- be sure to gray them out when the CAGASlider is disabled.
-
- ================================================================================
-
- CAGASlider's CPPb resource (for Constructor) should define these members:
-
- Direction: (Int32, viewed as Text)
- Values: hori, vert, nort, sout, east, west, prop
- Chooses the indicator type.
- nort, sout, east, west refer to the compass direction of "pointy" indicators.
- 'prop' chooses hori or vert depending on the pane proportions.
- Note: These values are not stored. They are converted into an enumerated
- type in the CAGASlider constructor.
- Number of Tick Marks: (Uint16)
- Values:
- 0: Don't show tick marks.
- 1: Show one tick mark for each allowed value of LControl::mValue.
- n > 1: Show n tick marks (n-1 intervals).
- Note: Number of Tick Marks is ignored for hori and vert types.
- Continuous Broadcast: (Boolean)
- Values:
- false: BroadcastMessage() is called only when the slider is released (on mouseUp).
- true: BroadcastMessage() is called every time the value changes during a drag.
-
- There is also a file called CAGASlider.CPPb which defines CAGASlider for Constructor.
- It has been hacked so that the Direction appears as a pop-up menu.
- The best way to use it is to place it in the same folder with Constructor
- so that Constructor (v2.2 or later) will load it on startup.
-
- *Note:* Constructor 2.2 cannot edit CAGASlider.CPPb without crashing.
-
- ================================================================================
-
- To add CAGASliders to your project:
-
- To a PowerPlant "Starter" project you will need to add the files:
- CAGASlider.cp
- AGA Slider Parts PICTs.rsrc
- UGrayscaleAppearance.cp
- UGWorld.cp
- You will also need: (in your project folder)
- CAGASlider.h
- UGrayscaleAppearance.h
- and: (in Constructor's folder)
- CAGASlider.CPPb
-
- ================================================================================
-
- Programming Notes:
-
- CAGASlider inherits from LControl and UGrayscaleAppearance.
-
- UGrayscaleAppearance is a class I wrote to encapsulate the AGA color definitions.
- UGrayscaleAppearance.cp also defines some LAttachments that are not used in this project.
-
- I set the background color of the Demo's window to gray by setting its "content" color
- in ResEdit. This adds a 'wctb' resource. There is no code in the project that draws
- the background color for the whole window, just for the sliders.
-
- James Jennings
- jennings@halcyon.com
-